package com.cjh.mybatis07.session;



import com.cjh.mybatis07.bulider.xml.XMLConfigBuilder;
import com.cjh.mybatis07.session.defaults.DefaultSqlSessionFactory;

import java.io.Reader;

/**
 * @Descripton 构建SqlSessionFactory的工厂
 * @Author cjh
 * @Date 2023/5/26 11:10
 */
public class SqlSessionFactoryBuilder {
    public SqlSessionFactory build(Reader reader){
        XMLConfigBuilder xmlConfigBuilder = new XMLConfigBuilder(reader);
        return build(xmlConfigBuilder.parse());
    }

    public SqlSessionFactory build(Configuration config){
        return  new DefaultSqlSessionFactory(config);
    }
}
